# -*- coding: utf-8 -*-
# @Time : 2022/1/11 16:14
# @FileName: LoginLeftWid.py

__author__ = 'Zhigen.li'


import os
import sys
from PyQt5.QtCore import Qt, QSize, QCoreApplication
from PyQt5.QtWidgets import QWidget, QGridLayout, QVBoxLayout, QPushButton, QLabel, QSpacerItem, QSizePolicy
from PyQt5.QtGui import QPainter, QPen, QColor, QPixmap, QIcon, QFont
from res.resource_rc import *
from Config.Config import CatchExceptions

class LoginLeftWid(QWidget):

    def __init__(self, parent):
        super(LoginLeftWid, self).__init__(parent)
        self.setObjectName("Form1")
        font = QFont()
        font.setFamily("SimSun-ExtB")
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        self.setFont(font)
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setHorizontalSpacing(7)
        self.gridLayout.setObjectName("gridLayout")
        self.verticalLayout = QVBoxLayout()
        self.verticalLayout.setContentsMargins(-1, 50, -1, -1)
        self.verticalLayout.setSpacing(0)
        self.verticalLayout.setObjectName("verticalLayout")
        self.pushButton = QPushButton(self)
        self.pushButton.setStyleSheet("QPushButton{\n"
                                      "    height: 80px;\n"
                                      "}")
        self.pushButton.setText("")
        icon = QIcon()
        icon.addPixmap(QPixmap(':/Img/model.png'), QIcon.Normal, QIcon.Off)
        self.pushButton.setIcon(icon)
        self.pushButton.setIconSize(QSize(80, 80))
        self.pushButton.setFlat(True)
        self.pushButton.setObjectName("pushButton")
        self.verticalLayout.addWidget(self.pushButton)
        self.label_3 = QLabel(self)
        self.label_3.setText("")
        self.label_3.setObjectName("label_3")
        self.verticalLayout.addWidget(self.label_3)
        self.label = QLabel(self)
        self.label.setAlignment(Qt.AlignCenter)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.label_2 = QLabel(self)
        font = QFont()
        font.setPointSize(9)
        font.setBold(False)
        font.setWeight(50)
        self.label_2.setFont(font)
        self.label_2.setAlignment(Qt.AlignCenter)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(50)
        self.label.setFont(font)
        self.label.setStyleSheet('QLabel{background-color: #ECF5FF;}')
        self.label_2.setStyleSheet('QLabel{background-color: #ECF5FF; color: rgb(141, 141, 141)}')
        self.label_3.setStyleSheet('QLabel{background-color: #ECF5FF;}')

        self.retranslateUi()

    def retranslateUi(self):
        _translate = QCoreApplication.translate
        self.setWindowTitle(_translate("Form1", "Form"))
        self.label.setText(_translate("Form1", "基金净值估算工具"))
        self.label_2.setText(_translate("Form1", "Fund Net Value Estimation Tool"))

    def paintEvent(self, event):
        painter = QPainter(self)
        pen = QPen(QColor('#1d953f'), 4, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)
        painter.setPen(pen)
        painter.drawPixmap(self.rect(), QPixmap(':/Img/modelLogoLeft.png'))
